package java1224;

public class Java02 {
    public static void main(String[] args) {
        //数组：创建数组、元素存取、数组遍历
        //创建数组方式一：已经知道要存储的数据
        int[] a = {1, 2, 3, 4, 5};
        //创建数组方式二：已经知道要存储元素的个数
        int[] b = new int[100];

        //元素存取
        int[] c = {4,7,9,3};
        int[] d = new int[5];
        int j = c[0];
        c[0] = c[3];
        c[3] = j;
//        System.out.println("c[0]:"+c[0]);
//        System.out.println("c[3]:"+c[3]);
        //数组遍历赋值
        for (int i = 0; i < 100; i++) {
            b[i] = a[i%5];
//            System.out.println(b[i]);
        }
        // 增强for循环,直接获取数组元素
        for (int i : c) {
            System.out.println(i);
        }
        // 数组排序
        int[] e = {5, 3, 1, 4, 2};
        for (int i = 0; i < e.length - 1; i++) {
            for (int jl = i + 1; jl < e.length; jl++) {
                if (e[i] > e[jl]) {
                    int temp = e[i];
                }
            }
        }
    }
}
